<?php
abstract class Session {

	static public function start() {
		session_start();
	}

	static public function check(){
		if (isset($_SESSION['fingerprint']))
		{
			if ($_SESSION['fingerprint'] != md5($_SERVER['REMOTE_ADDR']._SALT_.$_SERVER['HTTP_USER_AGENT']))
			{
				return false;
			}
		}
		else
		{
			$_SESSION['fingerprint'] = md5($_SERVER['REMOTE_ADDR']._SALT_.$_SERVER['HTTP_USER_AGENT']);
		}
		return true;
	}

	static public function destroy(){
		session_unset();
		session_destroy();
	}

	static public function newID(){
		session_regenerate_id(true);
	}

	static public function set($name, $value){
		$_SESSION[$name] = $value;
	}

	static public function get($name){
		if (isset($_SESSION[$name])){
			return $_SESSION[$name];
		}
	}

	static public function exists($name){
		return(isset($_SESSION[$name]));

	}
}